<template>
  <div class="header">
    <RouterLink to="/my">返回</RouterLink>
  </div>
  <div class="table">
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="url" label="用户" align="center" />
      <el-table-column prop="ip" label="权限" align="center"  />
      <el-table-column prop="method" label="操作" align="center"  />
    </el-table>
    <el-pagination layout="prev, pager, next" :page-size="10" :total="total" @current-change="reloadData" />
  </div>
</template>

<script setup>
import {ref,onMounted} from 'vue'
import {roleList} from '@/api/student'

const total = ref(0);
const pageCount = ref(1);
const pageLimit = ref(10);
const tableData = ref([]);

const loadData = ()=>{
  roleList(pageCount.value, pageLimit.value).then((res)=>{
    if(res.code==0){
      tableData.value = res.data.rows;
      total.value = res.data.total;
    }
  })
}

const reloadData = (p)=>{
  pageCount.value = p;
  loadData();
}

onMounted(()=>{
  loadData();
})
</script>

<style scoped>
  .header{
    text-align:right;padding:10px;background:#409eff;color:white;
  }
  .header a{
    color:white;
  }
  .login{
    padding:30px;
    margin-top:10px;
  }
</style>
  
  
  